<?php
include_once("conn.php");
session_start();

$newCate = $_POST["newCate"];

$query = "insert into category(cate_name,name) values('".$newCate."','".$_SESSION["current_user"]."')";
$result = mysql_query($query);
$query = "select cid,cate_name from category order by cid desc LIMIT 1";
$result = mysql_query($query);
while($cid = mysql_fetch_array($result) )
{
	$arr['cid']=$cid['cid'];
	$arr['cname']=$cid["cate_name"];
}

echo json_encode($arr);

?>